﻿// <copyright file="StringBuilderTest.cs" company="DotNetLib">
//
// .netlib: http://www.codeplex.com/DotNetLib
//
// Portions of this were part of the CodePlex "Extensions for .NET Framework"
//    project and written by Marco Minerva, mailto:marco.minerva@gmail.com
//
// This code is released under the New BSD License.
// A copy of this license is available at:
// http://www.codeplex.com/DotNetLib/license
//
// </copyright>

namespace DotNetLib.Tests
{
  using System.Text;
  using DotNetLib.Text;
  using global::Microsoft.VisualStudio.TestTools.UnitTesting;

  [TestClass()]
  public class StringBuilderTest : TestBase
  {
    [TestMethod()]
    public void TestAppendFormatLine()
    {
      StringBuilder builder = new StringBuilder();
      builder.AppendFormatLine("{0}", "string");
      Assert.AreEqual("string\r\n", builder.ToString());

      builder.Length = 0;
      builder.AppendFormatLine("{0} {1}", "string", "value");
      Assert.AreEqual("string value\r\n", builder.ToString());

      builder.Length = 0;
      builder.AppendFormatLine("{0} {1} {2}", "string", "value", "empty");
      Assert.AreEqual("string value empty\r\n", builder.ToString());

      builder.Length = 0;
      builder.AppendFormatLine("{0} {1} {2} {3}", "string", "value", "empty", "not");
      Assert.AreEqual("string value empty not\r\n", builder.ToString());

      builder.Length = 0;
      builder.AppendFormatLine(new BooleanFormatProvider(), "{0:yn}", true);
      Assert.AreEqual("Yes\r\n", builder.ToString());
    }
  }
}
